/*
 * Filehandler.h
 *
 * Created: 09-03-2013 13:15:05
 *  Author: Bootie
 */ 


#ifndef FILEHANDLER_H_
#define FILEHANDLER_H_

#include "../FatFS/ff.h"
#include <stddef.h>
#include <string.h>
#include <stdlib.h>

class Filehandler
{
	public:
		enum Filemode
		{
			READ = FA_READ,
			WRITE = FA_WRITE,
			CREATE_NEW = FA_CREATE_NEW,
			CREATE_ALWAYS = FA_CREATE_ALWAYS,
			OPEN_EXISTING = FA_OPEN_EXISTING,
			OPEN_ALWAYS = FA_OPEN_ALWAYS
		};
	
		Filehandler();
		~Filehandler();
		bool OpenFile(char *filepath, BYTE flag);
		bool ReadFile(char * _buffer, int _size);
		bool WriteFile(char * _buffer, int _size);
		bool CloseFile();
        
	private:
		FIL file;

    public:
        UINT FILE_BYTE_COUNT;
		
};



#endif /* FILEHANDLER_H_ */